<template>
	<view class="content">
		
		<view class="title fs18 C333">举报详情</view>
		<view class="process">
			<view class="flexsb processTitle">				                  																					                    
				<!-- <view :class="[(lis.complain_state >=10) ? 'processActive' : '']" class="processActive">填写举报内容</view>
				<view :class="[(lis.complain_state >=20) ? 'processActive' : '']" class="">平台审核</view>
				<view :class="[(lis.complain_state >=30) ? 'processActive' : '']" class="">举报完成</view>	
							 -->
				 <view style="margin-left: -40upx;"  class="processActive">填写举报内容</view>
				 <view style="margin-left: -25upx;"  class="">平台审核</view>
				 <view  class="">举报完成</view>				
			</view>

			<!-- <view v-if="lis.complain_state == 10"  style=" position: relative;z-index: 0;top: 40upx;width: 650upx;height: 2upx;margin: 0 auto;" class="progress-box">
				<progress activeColor="#ff4300" percent="0" stroke-width="2" />
			</view>
			<view v-if="lis.complain_state == 20"  style=" position: relative;z-index: 0;top: 40upx;width: 650upx;height: 2upx;margin: 0 auto;" class="progress-box">
				<progress activeColor="#ff4300" percent="25" stroke-width="2" />
			</view>
			<view v-if="lis.complain_state == 30"  style=" position: relative;z-index: 0;top: 40upx;width: 650upx;height: 2upx;margin: 0 auto;" class="progress-box">
				<progress activeColor="#ff4300" percent="50" stroke-width="2" />
			</view> -->
			<view style="position: relative;z-index: 0;top: 40upx;width: 520upx;height: 2upx;margin: 0 auto;" class="progress-box">
				<progress activeColor="#ff4300" percent="0" stroke-width="2" />
			</view>
			<!-- <view v-if="lis.complain_state == 20"  style=" position: relative;z-index: 0;top: 40upx;width: 650upx;height: 2upx;margin: 0 auto;" class="progress-box">
				<progress activeColor="#ff4300" percent="50" stroke-width="2" />
			</view>
			<view v-if="lis.complain_state == 30"  style=" position: relative;z-index: 0;top: 40upx;width: 650upx;height: 2upx;margin: 0 auto;" class="progress-box">
				<progress activeColor="#ff4300" percent="100" stroke-width="2" />
			</view> -->
			
			<!-- <view class="line"></view> -->
			<view  class="flexsb circles">
				<view class="">
					<image v-if="true" style="width: 40upx;height: 40upx;" src="/static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="false" style="width: 40upx;height: 40upx;" src="@/static/images/new_tousugg2.jpg" mode=""></image>
				</view>
				<view class="">
					<image v-if="false" style="width: 40upx;height: 40upx;" src="/static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="true" style="width: 40upx;height: 40upx;" src="@/static/images/new_tousugg2.jpg" mode=""></image>
				</view>
				<view class="">
					<image v-if="false" style="width: 40upx;height: 40upx;" src="/static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="true" style="width: 40upx;height: 40upx;" src="@/static/images/new_tousugg2.jpg" mode=""></image>
				</view>
			</view>
		<!-- 	<view v-if="lis.complain_state == 20" class="flexsb circles">
				<view class="">
					<image v-if="true" style="width: 40upx;height: 40upx;" src="../../static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="false" style="width: 40upx;height: 40upx;" src="../../static/images/new_tousugg2.jpg" mode=""></image>
				</view>
				<view class="">
					<image v-if="true" style="width: 40upx;height: 40upx;" src="../../static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="false" style="width: 40upx;height: 40upx;" src="../../static/images/new_tousugg2.jpg" mode=""></image>
				</view>
				<view class="">
					<image v-if="false" style="width: 40upx;height: 40upx;" src="../../static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="true" style="width: 40upx;height: 40upx;" src="../../static/images/new_tousugg2.jpg" mode=""></image>
				</view>		
			</view> -->
			
			<!-- <view class="flexsb circles">
				<view class="">
					<image v-if="true" style="width: 40upx;height: 40upx;" src="../../static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="false" style="width: 40upx;height: 40upx;" src="../../static/images/new_tousugg2.jpg" mode=""></image>
				</view>
				<view class="">
					<image v-if="true" style="width: 40upx;height: 40upx;" src="../../static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="false" style="width: 40upx;height: 40upx;" src="../../static/images/new_tousugg2.jpg" mode=""></image>
				</view>
				<view class="">
					<image v-if="true" style="width: 40upx;height: 40upx;" src="../../static/images/login/xuanzhong-icon.png" mode=""></image>
					<image v-if="false" style="width: 40upx;height: 40upx;" src="../../static/images/new_tousugg2.jpg" mode=""></image>
				</view>
			</view>				 -->
			
		</view>
		
		
		
		
		<view class="tousuContent">
			<view class="title2 fs18 C333">投诉信息</view>
			
			<view class="flex0 commonLi">
				<view style="width: 160upx;" class="fs18 C333">被举报商家:</view>
				<view class="fs18 Cf71c6e">{{goodsInfo.store_name}}</view>				
			</view>
			<view class="flex0 commonLi">
				<view style="width: 160upx;" class="fs18 C333">相关商品：</view>
				<view class="fs18 C999">
					<image style="width:85upx;height: 85upx;" :src="goodsInfo.goods_image" mode=""></image>
					<view style="width: 530upx;" class="twoline">{{goodsInfo.goods_name}}</view>				
				</view>				
			</view>
			<view class="flex0 commonLi">
				<view style="width: 160upx;" class="fs18 C333">举报类型：</view>				
				<view class="fs18 C999">
					<radio-group style="width: 500upx;" @change="radioChange">
						<label @click="radioIndex(index)" style="padding: 10upx 0;" class="flex0" v-for="(item, index) in type_list" :key="item.inform_type_id">
							<view>
								<radio  :checked="index === current" />
							</view>
							<view>{{item.inform_type_name}} ({{item.inform_type_desc.replace(/。/g,'')}})</view>
						</label>
					</radio-group>
					
				</view>				
			</view>
			<view class="flex0 commonLi">
				<view style="width: 160upx;" class="fs18 C333">举报主题：</view>
				<view class="fs18 C999" style="border: 1rpx solid #EEEEEE;width: 510rpx;">
					<view class="uni-list-cell-db">
						<picker @change="bindPickerChange" :value="index"  :range="array">
							<view class="uni-input">{{array[index]}}</view>
						</picker>
					</view>
				</view>				
			</view>
			<view class="flex0 commonLi">
				<view style="width: 160upx;" class="fs18 C333">举报内容：</view>
				<view class="fs18 C999">
					<textarea v-model="jbText"  style="width: 520upx;border: 1upx solid #f1f1f1;padding: 20upx;box-sizing: border-box;" value="" placeholder="内容不能超过100个字" />
				</view>				
			</view>
			<view class="flex0 commonLi">
				<view style="width: 160upx;" class="fs18 C333">添加图片：</view>
				<view class="fs18 C999">
					<view class="">
						<image style="width: 160upx;height: 160upx;" @click="upload(1)" :src="img1 ? img1 : `${picUrl}/w/pt.png`" mode=""></image>
						<image style="width: 160upx;height: 160upx;" @click="upload(2)" :src="img2 ? img2 : `${picUrl}/w/pt.png`" mode=""></image>
						<image style="width: 160upx;height: 160upx;" @click="upload(3)" :src="img3 ? img3 : `${picUrl}/w/pt.png`" mode=""></image>										 -->
					</view>
					<view class="fs18 C999">
						图片格式（jpg/jpeg/gif/png）
					</view>
				</view>				
			</view>			
			<view @click="submitBtn" class="submitBtn">确认提交</view>
		</view>
		
		<!-- <view class="bottom">
			<view :class="[(active2flag == index)?'active2':'']" @click="tab2(index,item.toUrl)" v-for="(item,index) in bottomBtn" :key="index">				
				<image :src="active2flag == index ? item.img2 :item.img1" mode=""></image>
				<view :class="[(active2flag == index) ? 'active2':'']">
					{{item.name}}
				</view>
			</view>
		</view>	 -->	
	</view>
	
	
</template>

<script>
	const requImg = require("@/common/api_sign/requImg.js")
	export default {
		data(){
			return{
				indexx:0,
				img1:"",
				img2:"",
				img3:"",
				isData:true,
				Imgdata:{},
				ImgInfo1:"",
				ImgInfo2:"",
				ImgInfo3:"",
				
				
				goods_id:8,
				jbType:0,
				jbTitle:'',
				inform_subject:"",
				jbText:"",
				
				goodsInfo:[],
				type_list:[],
				index:0,
			    array: [],
			    array2: [],
				items: [{
						value: 'USA',
						name: '出售禁售商品（销售商城禁止和限制交易规则下所规定的所有商品）'
					},
					{
						value: 'CHN',
						name: '产品质量问题（产品质量差、描述严重不相符）',
						checked: 'true'
					},
					{
						value: 'BRA',
						name: '欺诈（诈骗欺诈行为）'
					},
					{
						value: 'JPN',
						name: '违禁品（非正常营销）'
					},
					{
						value: 'ENG',
						name: '实名举报（把名字写上去）'
					}
				],
				current: 0,
				addImgUrl:"../../static/images/addImgBtn4.png",
				lis:[],
				id:'',
				active2flag:0,
				bottomBtn:[
					{"name":"首页","img1":"../../static/images/home_bottom11.png","img2":"../../static/images/home_bottom12.png","toUrl":"../home/index"},
					{"name":"分类","img1":"../../static/images/home_bottom21.png","img2":"../../static/images/home_bottom22.png","toUrl":"../sort/sortPage"},
					{"name":"分销","img1":"../../static/images/home_bottom31.png","img2":"../../static/images/home_bottom32.png","toUrl":"../distribution/list"},
					{"name":"购物车","img1":"../../static/images/home_bottom41.png","img2":"../../static/images/home_bottom42.png","toUrl":"../car/shopCar"},
					{"name":"会员中心","img1":"../../static/images/home_bottom51.png","img2":"../../static/images/home_bottom52.png","toUrl":"/pages/home/Personal_Center"}
				],
				isDisable:false
			}
		},
		onLoad(options) {
			this.goods_id=options.goods_id;
			this.getLis();
		},
		onShow() {
			
		},
		methods:{
			upImg(Imgurl,url){
					let that=this;
									
			},
			upload(i){
				let that = this;
				if(that.isData){
					uni.chooseImage({//图片选择上传
					 count: 1,
					 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					 sourceType: ['album','camera'], //从相册选择
					 success: (res)=> {
						const tempFilePaths = res.tempFilePaths;
						that.image = tempFilePaths[0];
						let  data = requImg.request("index.php?act=upload&op=uploadFile&buss_type="+that.$uploadType.uploadtype011);
						 var uper = uni.uploadFile({
						  // 需要上传的地址
						  url:that.$apiurl+"index.php?act=upload&op=uploadFile",
						  // filePath  需要上传的文件
						  filePath:that.image,
						  name: 'file',
						  formData: {
						    key:data.key,
							buss_type:data.buss_type,
							api_sign:data.api_sign, 
							comefrom:data.comefrom,
							api_time:data.api_time,
							// api_member_id:data.api_member_id,
							// api_member_name:data.api_member_name,
						 },
						  success(res1) {							  
							  let ImgInfo=JSON.parse(res1.data)
							  that.Imgdata={"filePath":ImgInfo.datas.file_url,"path":ImgInfo.datas.file_name};
							  console.log('that.Imgdata',that.Imgdata)
							  if(i==1){
							  	uni.showToast({
							  		title:"图片上传中",
							  		icon:"loading",
							  		
							  		success: () => {																				if(that.Imgdata.filePath){
											console.log('img1',that.Imgdata)
											that.img1 = that.Imgdata.filePath;
											that.ImgInfo1 =that.Imgdata.path;															console.log('that.img1',that.Imgdata.filePath)
										}else{
											uni.showToast({
												title:"图片上传超时",
												icon:"none"
											})
										}
							  		}
							  	})
							  	
							  	// that.img1=tempFilePaths[0];
							  }else if(i==2){
							  	uni.showToast({
							  		title:"图片上传中",
							  		icon:"loading",
							  		duration:3000,
							  		success: () => {									
							  			setTimeout(()=>{
							  				if(that.Imgdata.filePath){
							  					that.img2=that.Imgdata.filePath;
							  					that.ImgInfo2=that.Imgdata.path;
							  				}else{
							  					uni.showToast({
							  						title:"图片上传超时",
							  						icon:"none"
							  					})
							  				}
							  				
							  			},5000)
							  		}
							  	})
							  	
							  	// that.img2=tempFilePaths[0];
							  }
							  else if(i==3){
							  	uni.showToast({
							  		title:"图片上传中",
							  		icon:"loading",
							  		duration:3000,
							  		success: () => {									
							  			setTimeout(()=>{
							  				if(that.Imgdata.filePath){
							  					that.img3=that.Imgdata.filePath;
							  					that.ImgInfo3=that.Imgdata.path;
							  				}else{
							  					uni.showToast({
							  						title:"图片上传超时",
							  						icon:"none"
							  					})
							  				}										
							  			},5000)
							  		}
							  	})
							  	
							  	// that.img2=tempFilePaths[0];
							  }
						  },
						})
						
					 }
					});
				}else{
					uni.showToast({
						title:"图片正在上传中",
						icon:"loading"
					})
				}
				  
			},
			
			submitBtn(){
				if(this.Disable){
					return false;
				}
				this.Disable=true
				uni.showLoading({})
				this.$util.request({
					url: '/mobile/index.php?act=member_inform&op=inform_save',
					method: 'post',
					data: {
						"inform_goods_id":this.goods_id,
						"inform_subject_id":this.array2[this.indexx],
						"inform_content":this.jbText,
						"inform_pic1":this.ImgInfo1,
						"inform_pic2":this.ImgInfo2,
						"inform_pic3":this.ImgInfo3
					}
				}).then(res=>{	
					this.Disable=false
					if(res.error_code==0){
						uni.showToast({
							title:"提交成功",
							success() {
								setTimeout(()=>{
									uni.redirectTo({
										url:"list"
									})
								},1000)
							}
						})
					}else{
						uni.showToast({
							title:res.message,
							icon:"none"
						})
					}
					
					
				
				})
			},
			 bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value	
				this.indexx=e.target.value	
				// this.jbTitle=this.array2[this.indexx]
				// console.log(this.jbTitle)
			},
			radioIndex(a){
				console.log(a)
				this.jbType=a
				// this.array=this.type_list[a].subject
				this.array=[]
				this.array2=[]
				for(let i=0;i<this.type_list[a].subject.length;i++){
					this.array.push(this.type_list[a].subject[i].inform_subject_content)
					this.array2.push(this.type_list[a].subject[i].inform_subject_id)
				}
			
			},
			getLis(){
				this.$util.request({
					url: '/mobile/index.php?act=member_inform&op=inform_submit',
					method: 'get',
					data: {
						"goods_id":this.goods_id
					}
				}).then(res=>{
					if(res.error_code == 3940002){
						uni.showToast({
							title:res.message,
							icon:"none"
						})
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},2000)
					}
					if(res.error_code == 3940005){
						uni.showToast({
							title:res.message,
							icon:"none"
						})
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},2000)
					}
					this.goodsInfo=res.datas.goods_info
					this.type_list=res.datas.type_list	
					
					this.array=this.type_list[0].subject
					this.array=[]
					for(let i=0;i<this.type_list[0].subject.length;i++){
						this.array.push(this.type_list[0].subject[i].inform_subject_content)
					}
					for(let i=0;i<this.type_list[0].subject.length;i++){
						this.array2.push(this.type_list[0].subject[i].inform_subject_id)
					}
					
					console.log(res)	
				
				})
			},
			tab2(index,url){
				this.active2flag=index
				console.log(this.active2flag);
				uni.switchTab({
					url:url
				})
			},
			 radioChange: function(evt) {
				for (let i = 0; i < this.items.length; i++) {
					if (this.items[i].value === evt.target.value) {
						this.current = i;
						break;
					}
				}
			}
			
		}
	}
</script>

<style>
	.titleNview-placing {
		height: var(--status-bar-height);
		box-sizing: content-box;
	 }
	view{
		box-sizing: content-box;		
	}
	uni-page-body {
		background-color: #FFFFFF;
		color: rgb(102, 102, 102);
	}
	.titleNview-placing {
		height: var(--status-bar-height);
		box-sizing: content-box;
	 }
	.lh20{
		line-height: 20upx;
		height: 20upx;
	}
	.lh25{
		line-height: 25upx;
	}
	.lh30{
		line-height: 30upx;
	}
	.lh35{
		line-height: 35upx;
	}
	.lh40{
		line-height: 40upx;
	}
	.lh45{
		line-height: 45upx;
	}
	.lh50{
		line-height: 50upx;
	}
	.lh80{
		line-height: 80upx;
	}
	.C000{
		color: #000000;
	}
	.Ce13d97{
		color: #ff4300;
	}
	.Cfe0000{
		color: #ff4300;
	}
	.Cc06{
		color: #ff4300;
	}
	.mt55mb30{
		margin-top: 55upx;
		margin-bottom: 30upx;
	}
	.Cfff{
		color: #FFFFFF;
	}
	
	.flex{		
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-content: space-between;
	}
	.paddingL20{
		padding-left: 20upx;
	}
	.C999{
		color:#999 ;
	}
	.Cff0101{
		color:#ff0101 ;
	}
	.Cc00251{
		color: #c00251;
	}
	.strick{
		text-decoration: line-through;
	}
	.Cfe0000{
		color: #ff4300;
	}
	.line1{
		width: 430upx;
	}
	.hide{
		display: none;
	}
	.marginB20{
		margin-bottom: 20upx;
	}
	.oneLine{
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.twoline{
	   overflow : hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.pl20{
		padding-left: 20upx;
	}
	.positionT{
		position: relative;
		top: 50upx;
	}
	.paddingB15{
		padding-bottom: 15upx;
	}
	.borderB{
		border-bottom: 1px solid #f4f4f6;
	}
	.borderT{
		border-top: 1px solid #f4f4f6;
	}
	.gl{
		position: absolute;
		right: 30upx;
	}
	.pr30{
		padding-right: 30upx;
	}
	.C333{
		color: #333333;
	}
	.C666{
		color: #666666;
	}
	.Cf00{
		color: #ff0000;
	}
	
	.bold{
		font-weight: bold;
	}
	.C1d1d1d{
		color:#1d1d1d ;
	}
	.fl{
		float: left;
	}
	.fr{
		float: right;
	}
	.tac{
		text-align: center;
	}
	.Ce5258e{
		color: #e5258e;
	}
	.Cccc{
		color: #CCCCCC;
	}
	.Cf7881c{
		color: #f7881c;
	}
	uni-page-body {
		background-color: #FFFFFF;
		color: rgb(102, 102, 102);
	}		
	.fs30{
		/* font-size: 30upx */
		font-size: 45upx
	}
	.fs26{
		font-size:39upx
		/* font-size: 26upx */
	}
	.fs12{
		font-size: 18upx
		/* font-size: 12upx */
	}
	.fs16{
		font-size: 24upx
		/* font-size: 16upx */
	}
	.fs14{
		font-size: 21upx
		/* font-size: 14upx */
	}
	.fs15{
		font-size: 22.5upx
		/* font-size: 15upx */
	}
	.fs27{
		font-size: 40.5upx
		/* font-size: 27upx */
	}
	.fs18{
		font-size: 27upx
		/* font-size: 18upx */
	}
	.fs28{
		font-size: 42upx
		/* font-size: 28upx */
	}
	.fs10{
		font-size: 15upx
		/* font-size: 10upx */
	}
	.fs30{
		font-size: 45upx
		/* font-size: 28upx */
	}
	.fs36{
		font-size: 54upx
		/* font-size: 28upx */
	}
	
	.fs24{
		font-size: 36upx
		/* font-size: 24upx */
	}
	.fs20{
		font-size:30upx
		/* font-size: 20upx */
	}
	.fs22{
		font-size:33upx
		/* font-size: 22upx */
	}
	.fs21{
		font-size: 31.5upx
		/* font-size: 21upx */
	}	
	.flexsb{
		display: flex;
		justify-content: space-between;
	}
	.plr20{
		padding: 0 20upx;
	}
	.plr10{
		padding: 0 10upx;
	}
	.f6f4f5{
		background-color: #fff;
	}	
	.Cf74d0f{
		color: #f74d0f;
	}
	.C2dc34d{
		color: #2dc34d;
	}
	.mt20{
		margin-top: 20upx;
	}
	.ti2{
		text-indent: 2em;
	}
	
	
	.content{
		min-height: 100vh;
		background-color: #FFFFFF;
		padding-bottom: 200upx;
	}
	
	.bottom{
		box-sizing: border-box;
		padding: 0 10upx;
		background-color: #FFFFFF;
		position: fixed;
		z-index: 99999999999;
		left: 0;
		bottom: 0;
		height: 98upx;
		width: 100%;
		box-shadow: 0upx -1upx 10upx rgba(0,0,0,0.8);
		display: flex;
		flex-direction: row;
		justify-content: space-around;
	}
	.bottom view{
		font-size: 27upx;
		color: #666;
		text-align: center;
		margin-top: -4upx;
	}
	.bottom view.active2{
		color: #ff4300;
	}
	.bottom image{
		position: relative;
		top: 15upx;
		width: 48upx;
		height: 48upx;
	}
	.title{
		padding-left: 20upx;
		background-color: #fff;
		padding-top: 30upx;
		border-bottom: 1upx solid #f1f1f1;
	}
	.process{		
		padding: 30upx 80upx;
		background-color: #fff;
		box-sizing: border-box;
	}
	.circles{
		margin-top: 20upx;
		padding: 0 30upx;
	}
	.line{
		position: relative;
		z-index: 0;
		top: 40upx;
		width: 650upx;
		height: 2upx;
		margin: 0 auto;
	}
	.processTitle view.processActive{
		color: #ff4300;
	}
	.tousuContent{
		box-sizing: border-box;
		margin-top: 20upx;
		background-color: #fff;
	}
	.title2{
		padding-left: 20upx;
		height: 70upx;
		line-height: 90upx;
		padding-bottom: 15upx;
	}
	.commonLi{
		border-top: 1upx solid #f4f4f4;
		padding: 20upx;
	}
	.commonLi image+image{
		margin-left: 33upx;
	}
	.flex0{
		display: flex;
	}
	.Cf71c6e{
		color: #ff4300;
	}
	.submitBtn{
		width: 600upx;
		height: 70upx;
		line-height: 70upx;
		text-align: center;
		color: #fff;
		background-color: #c20552;
		margin: 50upx auto;
	}
</style>

